// Copyright (c) 2014 Jonathan Magnan (http://jonathanmagnan.com).
// All rights reserved (http://jonathanmagnan.com/extension-methods-library).
// Licensed under MIT License (MIT) (http://zextensionmethods.codeplex.com/license).

using System.Web;

#if EXTENSIONMETHODS_WITHNAMESPACE
namespace JHSoft.Extension.ExtensionMethods
{
#endif
    /// ###
    /// <summary>HTTP response extension.</summary>
#if EXTENSIONMETHODS_INTERNAL
    internal static partial class HttpResponseExtensions
#else
    public static partial class HttpResponseExtensions
#endif
    {
        /// <summary>
        ///     A HttpResponse extension method that reloads the given this.
        /// </summary>
        /// <param name="this">The @this to act on.</param>
        /// <example>
        ///     <code>
        ///           using System.IO;
        ///           using System.Web;
        ///           using Microsoft.VisualStudio.TestTools.UnitTesting;
        ///           using JHSoft.Extension.ExtensionMethods;
        ///           
        ///           namespace ExtensionMethods.Examples
        ///           {
        ///               [TestClass]
        ///               public class System_Web_HttpResponse_Reload
        ///               {
        ///                   [TestMethod]
        ///                   public void Reload()
        ///                   {
        ///                       var writer = new StringWriter();
        ///           
        ///                       // Type
        ///                       var @this = new HttpResponse(writer);
        ///           
        ///                       // Examples
        ///                       try
        ///                       {
        ///                           @this.Reload();
        ///                       }
        ///                       catch
        ///                       {
        ///                       }
        ///                   }
        ///               }
        ///           }
        ///     </code>
        /// </example>
        public static void Reload(this HttpResponse @this)
        {
            @this.Redirect(HttpContext.Current.Request.Url.ToString(), true);
        }
    }
#if EXTENSIONMETHODS_WITHNAMESPACE
}
#endif